Skip to content

🐛(frontend) redirect home page to login when homepage feature is disabled#2521

Merged
AntoLC merged 1 commit into
suitenumerique:mainfrom
maartendra:fix/home-respect-homepage-flag
Jul 21, 2026
Merged

🐛(frontend) redirect home page to login when homepage feature is disabled#2521
AntoLC merged 1 commit into
suitenumerique:mainfrom
maartendra:fix/home-respect-homepage-flag

Conversation

@maartendra

Copy link
Copy Markdown
Contributor

Purpose

FRONTEND_HOMEPAGE_FEATURE_ENABLED=false is supposed to disable the homepage: the Auth guard sends anonymous visitors on / straight to the login page instead of /home. But the /home page itself doesn't check the flag, so anyone following a direct link to /home/ still gets the full stock homepage. Since the auth guard only forces login on / and /docs (/home is an "allowed" path), nothing stops it from rendering.

We noticed this on our own instance (we run Docs with a custom skin as part of a sovereign EU business workspace): with the flag off, every entry point correctly leads to our SSO login, except a deep link to /home/, which still shows the default homepage.

Proposal

  • When FRONTEND_HOMEPAGE_FEATURE_ENABLED is false, /home now redirects anonymous visitors to the login page (gotoLogin(false) — no point returning to /home after login), mirroring the Auth component's behavior for /
  • e2e test: with the flag overridden to false, a direct visit to /home/ lands on the login page (sibling of the existing flag test)

External contributions

General requirements

Skip the checkbox below 👇 if you're fixing an issue or adding documentation

  • Before submitting a PR for a new feature I made sure to contact the product manager

CI requirements

  • I made sure that all existing tests are passing
  • I have signed off my commits with git commit --signoff (DCO compliance)
  • I have signed my commits with my SSH or GPG key (git commit -S)
  • My commit messages follow the required format: <gitmoji>(type) title description
  • I have added a changelog entry under ## [Unreleased] section (if noticeable change)

AI requirements

  • I used AI assistance to produce part or all of this contribution
  • I have read, reviewed, understood and can explain the code I am submitting
  • I can jump in a call or a chat to explain my work to a maintainer

🤖 Generated with Claude Code

https://claude.ai/code/session_01PhqB4SHsHCuMfprwLEN3rR

@maartendra
maartendra force-pushed the fix/home-respect-homepage-flag branch from 3415b0d to cc66ce1 Compare July 12, 2026 18:49
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7a8510d3-ce1d-4a22-8aed-65cee253e9f2

📥 Commits

Reviewing files that changed from the base of the PR and between 2df3fee and 5217dd4.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/frontend/apps/e2e/__tests__/app-impress/home.spec.ts
  • src/frontend/apps/impress/src/pages/home/index.tsx

Walkthrough

The Home page reads FRONTEND_HOMEPAGE_FEATURE_ENABLED and redirects unauthenticated users to login when the homepage is disabled. Its loading state now covers disabled-homepage and authenticated states. End-to-end coverage verifies direct /home/ navigation for disabled and enabled configurations, and the changelog documents the fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: antolc

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: redirecting the home page to login when the homepage feature is disabled.
Description check ✅ Passed The description is directly related to the changeset and accurately explains the bug, fix, and added test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/frontend/apps/e2e/__tests__/app-impress/home.spec.ts`:
- Around line 182-195: Add a positive Playwright test alongside the existing
disabled-feature case in the homepage navigation suite. Enable
FRONTEND_HOMEPAGE_FEATURE_ENABLED via overrideConfig, navigate directly to
/home/, and assert homepage content such as the first header is visible rather
than the login page.

In `@src/frontend/apps/impress/src/pages/home/index.tsx`:
- Around line 35-43: Update the home page’s useConfig-derived state and the
useEffect redirect guard so gotoLogin(false) runs only after configuration has
finished loading, using isFetched or the equivalent flag. Include the same
loading guard in the conditional rendering branch so the homepage remains
available while the feature flag is unresolved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b86534ce-b4fd-4ae7-85d2-02a6f44139c1

📥 Commits

Reviewing files that changed from the base of the PR and between 57ad4f4 and cc66ce1.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/frontend/apps/e2e/__tests__/app-impress/home.spec.ts
  • src/frontend/apps/impress/src/pages/home/index.tsx

Comment thread src/frontend/apps/e2e/__tests__/app-impress/home.spec.ts
Comment thread src/frontend/apps/impress/src/pages/home/index.tsx Outdated
maartendra added a commit to maartendra/docs that referenced this pull request Jul 12, 2026
Guard the login redirect on the config query being fetched, so a
pending feature flag is not mistaken for a disabled one, and add a
positive e2e test for a direct /home visit with the flag enabled.
Addresses CodeRabbit review on suitenumerique#2521.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhqB4SHsHCuMfprwLEN3rR
Signed-off-by: Maarten Draijer <maarten@madra.nl>
@AntoLC
AntoLC self-requested a review July 20, 2026 15:11
@AntoLC AntoLC added bug Something isn't working frontend labels Jul 20, 2026
@AntoLC
AntoLC force-pushed the fix/home-respect-homepage-flag branch from 9e7a9e5 to 2df3fee Compare July 21, 2026 08:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/frontend/apps/impress/src/pages/home/index.tsx`:
- Around line 31-45: Update the homepage redirect effect around authenticated
and homepageDisabled to wait until authentication has finished loading before
calling gotoLogin. Gate the redirect using isAuthLoading or hasInitiallyLoaded
so an unresolved authenticated state cannot redirect a logged-in user, while
preserving the existing disabled-homepage behavior after auth resolution.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7b2d6355-4256-499b-a12e-79e1668ad592

📥 Commits

Reviewing files that changed from the base of the PR and between 9e7a9e5 and 2df3fee.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/frontend/apps/e2e/__tests__/app-impress/home.spec.ts
  • src/frontend/apps/impress/src/pages/home/index.tsx

Comment thread src/frontend/apps/impress/src/pages/home/index.tsx Outdated
FRONTEND_HOMEPAGE_FEATURE_ENABLED=false makes the Auth guard send
anonymous visitors on / straight to login instead of /home, but the
/home page itself still rendered the full homepage when reached via a
direct link. Redirect it to login too, so disabling the feature really
disables the page.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhqB4SHsHCuMfprwLEN3rR
Signed-off-by: Maarten Draijer <maarten@madra.nl>
@AntoLC
AntoLC force-pushed the fix/home-respect-homepage-flag branch from 2df3fee to 5217dd4 Compare July 21, 2026 08:56

@AntoLC AntoLC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution ! 🎉

@AntoLC
AntoLC merged commit 5217dd4 into suitenumerique:main Jul 21, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants